﻿using System;

namespace Ast.Core.WinApi.DbgHelp
{
    public class DbgHelpConstant
    {
        [Flags]
        public enum SymActionCode : uint
        {
            CBA_DEBUG_INFO = 0x10000000,
            CBA_DEFERRED_SYMBOL_LOAD_CANCEL = 0x00000007,
            CBA_DEFERRED_SYMBOL_LOAD_COMPLETE = 0x00000002,
            CBA_DEFERRED_SYMBOL_LOAD_FAILURE = 0x00000003,
            CBA_DEFERRED_SYMBOL_LOAD_PARTIAL = 0x00000020,
            CBA_DEFERRED_SYMBOL_LOAD_START = 0x00000001,
            CBA_DUPLICATE_SYMBOL = 0x00000005,
            CBA_EVENT = 0x00000010,
            CBA_READ_MEMORY = 0x00000006,
            CBA_SET_OPTIONS = 0x00000008,
            CBA_SYMBOLS_UNLOADED = 0x00000004,
        }

        [Flags]
        public enum SymFlag : uint
        {
            SYMFLAG_CLR_TOKEN = 0x00040000,
            SYMFLAG_CONSTANT = 0x00000100,
            SYMFLAG_EXPORT = 0x00000200,
            SYMFLAG_FORWARDER = 0x00000400,
            SYMFLAG_FRAMEREL = 0x00000020,
            SYMFLAG_FUNCTION = 0x00000800,
            SYMFLAG_ILREL = 0x00010000,
            SYMFLAG_LOCAL = 0x00000080,
            SYMFLAG_METADATA = 0x00020000,
            SYMFLAG_PARAMETER = 0x00000040,
            SYMFLAG_REGISTER = 0x00000008,
            SYMFLAG_REGREL = 0x00000010,
            SYMFLAG_SLOT = 0x00008000,
            SYMFLAG_THUNK = 0x00002000,
            SYMFLAG_TLSREL = 0x00004000,
            SYMFLAG_VALUEPRESENT = 0x00000001,
            SYMFLAG_VIRTUAL = 0x00001000,
        }

        [Flags]
        public enum SymOption : uint
        {
            SYMOPT_ALLOW_ABSOLUTE_SYMBOLS = 0x00000800,
            SYMOPT_ALLOW_ZERO_ADDRESS = 0x01000000,
            SYMOPT_AUTO_PUBLICS = 0x00010000,
            SYMOPT_CASE_INSENSITIVE = 0x00000001,
            SYMOPT_DEBUG = 0x80000000,
            SYMOPT_DEFERRED_LOADS = 0x00000004,
            SYMOPT_DISABLE_SYMSRV_AUTODETECT = 0x02000000,
            SYMOPT_EXACT_SYMBOLS = 0x00000400,
            SYMOPT_FAIL_CRITICAL_ERRORS = 0x00000200,
            SYMOPT_FAVOR_COMPRESSED = 0x00800000,
            SYMOPT_FLAT_DIRECTORY = 0x00400000,
            SYMOPT_IGNORE_CVREC = 0x00000080,
            SYMOPT_IGNORE_IMAGEDIR = 0x00200000,
            SYMOPT_IGNORE_NT_SYMPATH = 0x00001000,
            SYMOPT_INCLUDE_32BIT_MODULES = 0x00002000,
            SYMOPT_LOAD_ANYTHING = 0x00000040,
            SYMOPT_LOAD_LINES = 0x00000010,
            SYMOPT_NO_CPP = 0x00000008,
            SYMOPT_NO_IMAGE_SEARCH = 0x00020000,
            SYMOPT_NO_PROMPTS = 0x00080000,
            SYMOPT_NO_PUBLICS = 0x00008000,
            SYMOPT_NO_UNQUALIFIED_LOADS = 0x00000100,
            SYMOPT_OVERWRITE = 0x00100000,
            SYMOPT_PUBLICS_ONLY = 0x00004000,
            SYMOPT_SECURE = 0x00040000,
            SYMOPT_UNDNAME = 0x00000002
        }

        public enum SymTagEnum : uint
        {
            SymTagNull,
            SymTagExe,
            SymTagCompiland,
            SymTagCompilandDetails,
            SymTagCompilandEnv,
            SymTagFunction,
            SymTagBlock,
            SymTagData,
            SymTagAnnotation,
            SymTagLabel,
            SymTagPublicSymbol,
            SymTagUdt,
            SymTagEnum,
            SymTagFunctionType,
            SymTagPointerType,
            SymTagArrayType,
            SymTagBaseType,
            SymTagTypedef,
            SymTagBaseClass,
            SymTagFriend,
            SymTagFunctionArgType,
            SymTagFuncDebugStart,
            SymTagFuncDebugEnd,
            SymTagUsingNamespace,
            SymTagVTableShape,
            SymTagVTable,
            SymTagCustom,
            SymTagThunk,
            SymTagCustomType,
            SymTagManagedType,
            SymTagDimension,
            SymTagMax
        };

        public enum SymType : uint
        {
            SymNone = 0,
            SymCoff,
            SymCv,
            SymPdb,
            SymExport,
            SymDeferred,
            SymSym, // .sym file
            SymDia,
            SymVirtual,
            NumSymTypes
        }

        public enum BasicType : uint
        {
            BtNoType = 0,
            BtVoid = 1,
            BtChar = 2,
            BtWChar = 3,
            BtInt = 6,
            BtUInt = 7,
            BtFloat = 8,
            BtBcd = 9,
            BtBool = 10,
            BtLong = 13,
            BtULong = 14,
            BtCurrency = 25,
            BtDate = 26,
            BtVariant = 27,
            BtComplex = 28,
            BtBit = 29,
            BtBstr = 30,
            BtHresult = 31
        }

        [Flags]
        public enum SymUndecorateOption : uint
        {
            UNDNAME_32_BIT_DECODE = 0x0800, // Undecorate 32-bit decorated names.
            UNDNAME_COMPLETE = 0x0000, // Enable full undecoration.
            UNDNAME_NAME_ONLY = 0x1000, // Crack only the name for primary declaration. Returns [scope::]name. Does expand template parameters.
            UNDNAME_NO_ACCESS_SPECIFIERS = 0x0080, // Disable expansion of access specifiers for members.
            UNDNAME_NO_ALLOCATION_LANGUAGE = 0x0010, // Disable expansion of the declaration language specifier.
            UNDNAME_NO_ALLOCATION_MODEL = 0x0008, // Disable expansion of the declaration model.
            UNDNAME_NO_ARGUMENTS = 0x2000, // Do not undecorate function arguments.
            UNDNAME_NO_CV_THISTYPE = 0x0040, // Disable expansion of CodeView modifiers on the this type for primary declaration.
            UNDNAME_NO_FUNCTION_RETURNS = 0x0004, // Disable expansion of return types for primary declarations.
            UNDNAME_NO_LEADING_UNDERSCORES = 0x0001, // Remove leading underscores from Microsoft keywords.
            UNDNAME_NO_MEMBER_TYPE = 0x0200, // Disable expansion of the static or virtual attribute of members.
            UNDNAME_NO_MS_KEYWORDS = 0x0002, // Disable expansion of Microsoft keywords.
            UNDNAME_NO_MS_THISTYPE = 0x0020, // Disable expansion of Microsoft keywords on the this type for primary declaration.
            UNDNAME_NO_RETURN_UDT_MODEL = 0x0400, // Disable expansion of the Microsoft model for user-defined type returns.
            UNDNAME_NO_SPECIAL_SYMS = 0x4000, // Do not undecorate special names, such as vtable, vcall, vector, metatype, and so on.
            UNDNAME_NO_THISTYPE = 0x0060, // Disable all modifiers on the this type.
            UNDNAME_NO_THROW_SIGNATURES = 0x0100, // Disable expansion of throw-signatures for functions and pointers to functions.
        }

        public enum ImagehlpSymbolTypeInfo : uint
        {
            TI_GET_SYMTAG,
            TI_GET_SYMNAME,
            TI_GET_LENGTH,
            TI_GET_TYPE,
            TI_GET_TYPEID,
            TI_GET_BASETYPE,
            TI_GET_ARRAYINDEXTYPEID,
            TI_FINDCHILDREN,
            TI_GET_DATAKIND,
            TI_GET_ADDRESSOFFSET,
            TI_GET_OFFSET,
            TI_GET_VALUE,
            TI_GET_COUNT,
            TI_GET_CHILDRENCOUNT,
            TI_GET_BITPOSITION,
            TI_GET_VIRTUALBASECLASS,
            TI_GET_VIRTUALTABLESHAPEID,
            TI_GET_VIRTUALBASEPOINTEROFFSET,
            TI_GET_CLASSPARENTID,
            TI_GET_NESTED,
            TI_GET_SYMINDEX,
            TI_GET_LEXICALPARENT,
            TI_GET_ADDRESS,
            TI_GET_THISADJUST,
            TI_GET_UDTKIND,
            TI_IS_EQUIV_TO,
            TI_GET_CALLING_CONVENTION,
            TI_IS_CLOSE_EQUIV_TO,
            TI_GTIEX_REQS_VALID,
            TI_GET_VIRTUALBASEOFFSET,
            TI_GET_VIRTUALBASEDISPINDEX,
            TI_GET_IS_REFERENCE,
            TI_GET_INDIRECTVIRTUALBASECLASS
        }

        [Flags]
        public enum SymSearchOption : uint
        {
            SYMSEARCH_MASKOBJS = 0x1,
            SYMSEARCH_RECURSE = 0x2,
            SYMSEARCH_GLOBALSONLY = 0x4,
            SYMSEARCH_ALLITEMS = 0x8,
        }
    }
}